<?php echo $header; ?><?php echo $column_left; ?>
<div class="d4-col-right right">
			<?php echo $menu_content; ?>
			
			<div class="padder"></div>

			<div class="category-head">
				<h2><?php echo $heading_title; ?></h2>
			</div>

				

			<div class="toolbar">
				<div class="pager">
					<p class="amount">
						 Có <strong><?php echo $total_product;?> sản phẩm</strong> <?php echo $heading_title; ?>
					</p>
					<div class="limiter">
						<label>Sắp xếp sản phẩm</label>
						 <select name="sort" onchange="location = this.value">
							 <?php foreach ($sorts as $sorts) { ?>
      							 <?php if (($sort . '-' . $order) == $sorts['value']) { ?>
         							 <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
          						 <?php } else { ?>
          							<option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
          						<?php } ?>
          					<?php } ?>
						</select>      
					</div>
					<div style="clear:both;"></div>
				</div>
				 <div style="clear:both;"></div>
			</div>


			<?php if($products){?>
			<div class="listing-type-grid  catalog-listing padder"> <!-- the class name will change to .listing-type-cell if viewing in list mode -->
				  <?php for ($i = 0; $i < sizeof($products); $i = $i + 4) { ?>
					 <?php for ($j = $i; $j < ($i + 4); $j++) { ?>
					 	<?php if (isset($products[$j])) {?>
				<div class="thumb-show">
				
					<h5><a href="<?php echo $products[$j]['href']; ?>" title="<?php echo $products[$j]['name']; ?>"><?php echo $products[$j]['name']; ?></a></h5>
					<div class="d4-product-bg">
						<a href="<?php echo $products[$j]['href']; ?>">
							<img id="image<?php echo $products[$j]['id']; ?>" src="<?php if($products[$j]['thumb']!=""){ ?><?php echo $products[$j]['thumb']; ?><?php }else{?>image/no_image.jpg<?php }?>" width="131" height="131" />
						</a>
						<div class="price-box">
							<span class="regular-price" id="product-price-368"><span class="price"><?php echo number_format($products[$j]['price']) ; ?> VNĐ</span> / <?php echo $products[$j]['unit']; ?></span> <!-- thay đổi đơn vị tính theo db -->
						</div>
					</div>
					<form id="product<?php echo $products[$j]['id']; ?>" enctype="multipart/form-data" method="post" action="index.php?route=checkout/cart">
					<div class="price-box">
						<span class="regular-price" style="top:-10px;position:relative;">Số lượng : <input name="quantity" type="text" value="01" style="width:32px;" onkeypress="return numbersonly(this, event);" maxlength="4" /></span>
						<a href="javascript:;" id="add_to_cart" ><img onclick="addtocart(<?php echo $products[$j]['id']; ?>);" src="catalog/view/theme/default/images/d4-btn-buy.png" alt="Add to Cart"/></a>
					</div> 
					  <input type="hidden" name="product_id" value="<?php echo $products[$j]['id']; ?>" />
                	  <input type="hidden" name="redirect" value="<?php echo str_replace('&', '&amp;', $redirect); ?>" />      
					</form>
				</div>
				<?php }?>
				<?php }?>
				<?php }?>
				<div class="clear"></div>

				
				<p class="amount">
					<?php echo $pagination; ?>
				</p>
				
			</div>
			<script type="text/javascript">
			<!--
			function numbersonly(myfield, e)
			{
			var key;
			var keychar;
			if (window.event)
			key = window.event.keyCode;
			else if (e)
			key = e.which;
			else
			return true;
			keychar = String.fromCharCode(key);
			// control keys
			if ((key==null) || (key==0) || (key==8) ||
			(key==9) || (key==27) || (key==13) || (key==46))
			return true;
			// numbers
			else if ((("0123456789").indexOf(keychar) > -1))
			return true;
			// decimal point jump
			else
			return false;
			}
			//-->
			</script>  
			<?php }?>
		</div>
		</div>
<?php echo $footer; ?> 